import java.util.Scanner;

/**
 * Created by L.jp
 * Description:
 * User: 86189
 * Date: 2021-10-07
 * Time: 21:31
 */
public class Main {
    public static User login() {
        System.out.println("========= 欢迎来到书籍信息管理系统！！！ =========");
        System.out.print("请输入您的姓名：");
        Scanner reader = new Scanner(System.in);
        String name = reader.nextLine();
        System.out.println("欢迎 " + name + " 登录系统");
        System.out.println("请问您是管理员（0），还是普通用户（1）：");
        int choice = reader.nextInt();
        if (choice == 0) {
            return new AdiminUser(name);
        } else {
            return new Normal(name);
        }
    }

    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = login();
        while (true) {
            int choice = user.menu();
            user.doOperation(choice, bookList);
        }
    }
}

